package newmeeting;

import java.awt.*;

import javax.swing.*;

public class AppointmentRenderer implements ListCellRenderer{
	@Override
	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean isSelected, boolean cellHasFocus) {
		
		Appointment appointment = (Appointment) value; 
		JLabel label; 
 
		if (appointment.getTitle().equals("title of meeting") && appointment.getDate().equals("dd.mm.yy")) { 
			label = new JLabel("New Appointment", JLabel.LEFT); 
		} 
		else { 
			label = new JLabel(appointment.getTitle() + " | " + appointment.getDate(), JLabel.LEFT); 
		} 
		if (isSelected) { 
			label.setForeground(Color.RED); 
		} 
		return label;
		
	}

}
